<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .div1 {
      width: 100px;
      height: 100px;
      background-color: red;
    }
    .div2 {
      width: 150px;
      height: 150px;
      background-color: green;
    }
    .div3 {
      width: 250px;
      height: 250px;
      background-color: pink;
    }
  </style>
</head>
<body>
  <div id="app">
    <p>修饰符——事件修饰符</p>
    <p>.prevent 阻止默认事件</p>
    <div class="div1" @contextmenu.prevent="show"></div>
    <p>.stop 阻止冒泡</p>
    <div class="div3" @click="showDiv('div3')">
      <div class="div2" @click.stop="showDiv('div2')">
        <div class="div1" @click="showDiv('div1')"></div>
      </div>
    </div>
    <p>.capture 改为捕获，有capture的优先执行</p>
    <div class="div3" @click.capture="showDiv('div3')">
      <div class="div2" @click.capture="showDiv('div2')">
        <div class="div1" @click.capture="showDiv('div1')"></div>
      </div>
    </div>
    <p>.self 只能由自己触发,别的元素不能触发</p>
    <div class="div3" @click.self="showDiv('div3')">
      <div class="div2" @click.self="showDiv('div2')">
        <div class="div1" @click="showDiv('div1')"></div>
      </div>
    </div>
  </div>
  <script src="../vue.js"></script>
  <script>
    let vm = new Vue({
      el: '#app',
      data: {

      },
      methods: {
        show() {
          console.log('右键');
        },
        showDiv(val) {
          console.log(val);
        }
      },
    })
  </script>
</body>
</html>